from rest_framework import serializers
from userApp.models import Student, SCHOOL_CHIOCES
from django.contrib.auth.models import User, Group


class StudentSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Student
        fields = ('url', 'name', 'sno', 'school')

#  定义一些用户和组,用户后续访问资源的用户凭证
class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ('url', 'username', 'email', "first_name", "last_name")

class GroupSerializer(serializers.ModelSerializer):
    class Meta:
        model = Group
        fields = ("name", )
